package ru.ssau.university.persistence.dao;

import java.util.List;

import org.hibernate.Query;

import ru.ssau.hibernate.util.AbstractDAO;
import ru.ssau.university.persistence.entity.Department;

public class DepartmentDAO extends AbstractDAO<Department>{
	public DepartmentDAO() {
		this.objectClass = Department.class;
	}

	@SuppressWarnings("unchecked")
	public List<Department> getDepartmentsForFaculty(Long facultyId) {
		Query q = createQuery("select d from Department d where d.faculty.id=:facultyId");
		q.setLong("facultyId", facultyId);
		return q.list();
	}	
}
